#ifndef REPORTEDITOR_H
#define REPORTEDITOR_H

#include <QWidget>
class QLocalServer;
class DiagnosticTemplateModel;
class QMdiSubWindow;
class ImageInstance;

namespace Ui {
class ReportEditor;
}

class ReportEditor : public QWidget
{
    Q_OBJECT

public:
    explicit ReportEditor(QWidget *parent = 0);
    ~ReportEditor();

    bool isServerListening();
    bool setActiveReport(const QString &studyUid);
    void closeAllReports();

public slots:
    void openReports(const QStringList &paths);

private slots:
    void onNewConnection();
    void on_openDirBtn_clicked();

    void on_saveBtn_clicked();
    void on_completeBtn_clicked();
    void on_verifyBtn_clicked();
    void on_imageBtn_clicked();
    void on_paperBtn_clicked();
    void on_printBtn_clicked();
    void on_settingsBtn_clicked();
    void on_helpBtn_clicked();
    void on_fullScreenBtn_clicked(bool checked);

    void openFiles();
    void revokeComplete();
    void revokeVerify();
    void onRemoveImage();
    void onRemoveImage(ImageInstance *image);
    void onPrintPreview();
    void onTemplateItemSelected(const QString &findings, const QString &conclusion);
    void onSubWindowActivated(QMdiSubWindow *win);
    void onReportClosed(const QString &uid);

private:
    void setupComponent();
    void setupToolBar();
    void setupConnection();
    void startLocalServer();
    QMdiSubWindow *searchReport(const QString &file);
    void setReadOnly(bool yes);

    Ui::ReportEditor *ui;
    QLocalServer *server;
    DiagnosticTemplateModel *tempModel;
    QMdiSubWindow *currentWindow;
};

#endif // REPORTEDITOR_H
